<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>这是我的个人OJ系统</title>
    <link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&family=Roboto:wght@400;700&display=swap"
        rel="stylesheet">
    <style>
        /* 全局样式 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Poppins', 'Roboto', sans-serif;
        }

        html,
        body {
            width: 100%;
            height: 100%;
            background-color: #f5f7fa;
            color: #333;
        }

        .container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
        }

        .navbar {
            width: 100%;
            background-color: rgba(255, 255, 255, 0.9);
            padding: 15px 20px;
            box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
            position: fixed;
            top: 0;
            left: 0;
            z-index: 1000;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .navbar a {
            color: #333;
            font-size: large;
            text-decoration: none;
            padding: 10px 15px;
            position: relative;
            transition: all 0.3s ease-in-out;
        }

        .navbar a:hover {
            color: #4CAF50;
        }

        .navbar a::after {
            content: '';
            display: block;
            width: 0;
            height: 2px;
            background-color: #4CAF50;
            transition: width 0.3s ease-in-out;
            position: absolute;
            left: 50%;
            transform: translateX(-50%);
            bottom: -5px;
        }

        .navbar a:hover::after {
            width: 100%;
        }

        .navbar .logo {
            font-size: 24px;
            color: #4CAF50;
            letter-spacing: 1px;
            text-transform: uppercase;
            font-weight: 700;
        }

        .navbar .login {
            margin-left: auto;
            position: relative;
        }

        .navbar .login img {
            border-radius: 50%;
            cursor: pointer;
            width: 40px;
            height: 40px;
        }

        .navbar .login .dropdown {
            display: none;
            position: absolute;
            right: 0;
            top: 50px;
            background-color: white;
            box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
            border-radius: 5px;
            overflow: hidden;
            z-index: 1000;
        }

        .navbar .login .dropdown a {
            display: block;
            padding: 10px 20px;
            white-space: nowrap;
            color: #333;
            text-decoration: none;
            transition: background-color 0.3s ease;
        }

        .navbar .login .dropdown a:hover {
            background-color: #f5f5f5;
        }

        .navbar .login .dropdown.show {
            display: block;
        }

        .content {
            flex: 1;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            padding: 80px 20px 20px;
        }

        .content h1 {
            font-size: 36px;
            margin-bottom: 20px;
        }

        .content p {
            font-size: 18px;
            margin-bottom: 20px;
        }

        .content a {
            padding: 10px 20px;
            background-color: #4CAF50;
            color: white;
            font-size: 18px;
            text-decoration: none;
            border-radius: 5px;
            transition: background-color 0.3s ease;
        }

        .content a:hover {
            background-color: #218838;
        }

        /* 响应式设计 */
        @media screen and (max-width: 768px) {
            .navbar a {
                padding: 8px 10px;
                font-size: medium;
            }

            .content h1 {
                font-size: 28px;
            }

            .content p,
            .content a {
                font-size: 16px;
            }

            .navbar .menu-icon {
                display: block;
                cursor: pointer;
                font-size: 28px;
                margin-right: 20px;
            }

            .navbar .login {
                margin-right: 10px;
            }

            .navbar-links {
                display: none;
                flex-direction: column;
                background-color: white;
                position: absolute;
                top: 60px;
                left: 0;
                width: 100%;
                box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
            }

            .navbar-links.active {
                display: flex;
            }

            .navbar-links a {
                padding: 15px;
                text-align: center;
            }
        }
    </style>
</head>

<body>
    <div class="container">
        <!-- 导航栏 -->
        <div class="navbar">
            <div class="logo">OJ平台</div>
            <div class="menu-icon">&#9776;</div>
            <div class="navbar-links">
                <a href="/bch">首页</a>
                <a href="/all_questions">题库</a>
                <a href="/admin">在线测试</a>
                <a href="on_insert_q.html">在线录题</a>
                <a href="/user_center">用户中心</a>
            </div>
            <div class="login">
                <img src="/picture/head.jpeg" alt="User Avatar">
                <div class="dropdown">
                    <!-- <a href="/profile">个人资料</a> -->
                    <a href="/" id="logout">退出</a>
                </div>
            </div>
        </div>

        <!-- 网页内容 -->
        <div class="content">
            <h1>欢迎来到我们的OnlineJudge平台</h1>
            <p>这是我个人独立开发的一个在线OJ平台</p>
            <a href="/all_questions">点击我开始编程啦！</a>
        </div>
    </div>
    <script>

        document.querySelector('.menu-icon').addEventListener('click', function () {
            document.querySelector('.navbar-links').classList.toggle('active');
        });

        document.querySelector('.login img').addEventListener('click', function () {
            document.querySelector('.login .dropdown').classList.toggle('show');
        });

        document.getElementById('logout').addEventListener('click', function (event) {
            // 获取所有cookie
            var cookies = document.cookie.split(";");

            // 遍历并删除每一个cookie
            for (var i = 0; i < cookies.length; i++) {
                var cookie = cookies[i];
                var eqPos = cookie.indexOf("=");
                var name = eqPos > -1 ? cookie.substr(0, eqPos) : cookie;
                // 设置过期时间为过去的时间来删除cookie
                document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";
            }
        });
    </script>
</body>

</html>